#!/bin/csh

#  only print those lines that are "#####" in all tests.

foreach file ( \
    umf_analyze.c umf_apply_order.c umf_assemble.c \
    umf_assemble_fixq.c umf_blas3_update.c umf_build_tuples.c \
    umf_cholmod.c umf_colamd.c umf_create_element.c umf_extend_front.c \
    umf_free.c umf_fsize.c umf_garbage_collection.c umf_get_memory.c \
    umf_grow_front.c umf_init_front.c umf_is_permutation.c umf_kernel.c \
    umf_kernel_init.c umf_kernel_wrapup.c umf_lhsolve.c umf_local_search.c \
    umf_lsolve.c umf_ltsolve.c umf_malloc.c umf_mem_alloc_element.c \
    umf_mem_alloc_head_block.c umf_mem_alloc_tail_block.c \
    umf_mem_free_tail_block.c umf_mem_init_memoryspace.c \
    umf_realloc.c umf_report_perm.c umf_report_vector.c umf_row_search.c \
    umf_scale.c umf_scale_column.c umf_set_stats.c umf_singletons.c \
    umf_solve.c umf_start_front.c umf_store_lu.c umf_store_lu_drop.c \
    umf_symbolic_usage.c \
    umf_transpose.c umf_triplet_map_nox.c umf_triplet_map_x.c \
    umf_triplet_nomap_nox.c umf_triplet_nomap_x.c umf_tuple_lengths.c \
    umf_uhsolve.c umf_usolve.c umf_utsolve.c umf_valid_numeric.c \
    umf_valid_symbolic.c umfpack_col_to_triplet.c umfpack_defaults.c \
    umfpack_free_numeric.c umfpack_free_symbolic.c umfpack_get_determinant.c \
    umfpack_get_lunz.c umfpack_get_numeric.c umfpack_get_symbolic.c \
    umfpack_load_numeric.c umfpack_load_symbolic.c umfpack_numeric.c \
    umfpack_qsymbolic.c umfpack_report_control.c umfpack_report_info.c \
    umfpack_report_matrix.c umfpack_report_numeric.c umfpack_report_perm.c \
    umfpack_report_status.c umfpack_report_symbolic.c umfpack_report_triplet.c \
    umfpack_report_vector.c umfpack_save_numeric.c umfpack_save_symbolic.c \
    umfpack_scale.c umfpack_solve.c umfpack_symbolic.c \
    umfpack_tictoc.c umfpack_timer.c umfpack_transpose.c \
    umfpack_triplet_to_col.c umfpack_wsolve.c \
	)
    echo '================================================================================'
    echo $file
    echo '================================================================================'
	cat /dev/null > Out/tcov_tmp
	foreach fdirs (Out/?_??)
	    cat -n $fdirs/UMFPACK/Source/$file.gcov | grep '#####' >> Out/tcov_tmp
	end
	sort -n Out/tcov_tmp | uniq -c
end

foreach file ( \
	amd_1.c amd_2.c amd_aat.c amd_control.c amd_defaults.c \
	amd_info.c amd_order.c amd_postorder.c amd_post_tree.c \
	amd_preprocess.c amd_valid.c \
	)
    echo '================================================================================'
    echo $file
    echo '================================================================================'
	cat /dev/null > Out/tcov_tmp
	foreach fdirs (Out/?_??)
	    cat -n $fdirs/AMD/Source/$file.gcov | grep '#####' >> Out/tcov_tmp
	end
	sort -n Out/tcov_tmp | uniq -c
end


echo '================================================================================'
echo 'Last line of each output file: '
echo '================================================================================'

foreach file (Out/*_*/ut.out)
	echo $file 
	tail -1 $file 
	echo '================================================================='
end
